package org.tech4j.common.core.model.response;

import java.io.Serial;
import java.util.Collection;
import java.util.List;

/**
 * @program: tech4j-common
 * @description:
 * @author: YuKai Fan
 * @create: 2025/3/1 21:37
 **/
public class MultiResponse<T> extends BaseResponse {
    @Serial
    private static final long serialVersionUID = 1813293299484492580L;

    private Collection<T> data;

    public static <T> MultiResponse<T> of(Collection<T> data) {
        MultiResponse<T> multiResponse = new MultiResponse<>();
        multiResponse.setSuccess(true);
        multiResponse.setData(data);
        return multiResponse;
    }

    public static <T> MultiResponse<T> fail(String errorCode, String errorMessage) {
        MultiResponse<T> multiResponse = new MultiResponse<>();
        multiResponse.setSuccess(false);
        multiResponse.setResponseCode(errorCode);
        multiResponse.setResponseMessage(errorMessage);
        return multiResponse;
    }


    public Collection<T> getData() {
        return data;
    }

    public void setData(Collection<T> data) {
        this.data = data;
    }
}
